<?php

/**
 * Description of TreeList
 *
 * @author gun
 */
class CHelper_Controller_Helper_TreeList extends Zend_Controller_Action_Helper_Abstract{
    private static $_merge = array();
    
    public function TreeList($data = array(), $selected = '') {
        $tmp = array();
        array_unshift( self::$_merge, '<option value="">TOP</option>' );
        
        foreach ($data as $value) {
            $tmp = array_values($value);
            self::$_merge[] = '<option value="'. $data['menuID'] .'"'. 
                    ((0 !== strlen($selected) && $selected === $data['menuID']) ? 
                    'selected="selected"' : '') .' style="margin-right: 10px">' . $data['parent']['name'] . '</option>';
        }
        
        return self::$_merge;
    }
    
    public function direct($data = array(), $selected = '') {
        return $this->TreeList($data, $selected);
    }
}

?>
